import { reqC1, reqC2, reqC3 } from "@/api/attr";
import { defineStore } from "pinia";

const useCategoryStore = defineStore("Category", {
  state: (): any => {
    return {
      c1Arr: [],
      c1Id: "",
      c2Arr: [],
      c2Id: "",
      c3Arr: [],
      c3Id: "",
    };
  },
  actions: {
    async getC1() {
      let result: any = await reqC1();
      this.c1Arr = result;
    },
    async getC2() {
      let result = await reqC2(this.c1Id);
      this.c2Arr = result;
    },
    async getC3() {
      let result = await reqC3(this.c2Id);
      this.c3Arr = result;
    },
  },
  getters: {},
});
export default useCategoryStore;
